M.define("customerFacade", function (customerRepository) {

    function sayHi(resp) {
        print(resp);
    }

    return {
        register : function (customer) {
            /**
             *  异步
             */

            customerRepository.save( customer, sayHi);

        },
        login : function (data) {
            /**
             *  同步
             */

            var customer = customerRepository.findByUsername( data.username);

            sayHi(customer);

        }
    }
});